
//函数一般写法
 function test1(a:string,b:string,c?:number):string{
    console.log(a.substring(0,1)+b.substring(0,1))

    return a.substring(0,1)+b.substring(0,1)
 }

 var myname:string = test1("aaa","bbb",99)
 console.log(myname)

 //---------------------------------


 interface IFunc{
     (a:string,b:string,c?:number):string
 }


 var myfunc2:IFunc = function test1(a:string,b:string,c?:number):string{
    console.log(a.substring(0,1)+b.substring(0,1))

    return a.substring(0,1)+b.substring(0,1)
 }
//  myfunc2.test1('1','2',2)

 interface Iobj {
     name:string,
     age:number,
     getUserId:(val:string)=>string
 }
//val是形参    后面的name才是实参
 var obj:Iobj = {
     name:"kerwin",
     age:11,
     getUserId:(name:string)=>{
         return name
     }
 }

 obj.getUserId("符合定义")

export default {}